//
//  AboutScreen.cpp
//  match2
//
//  Created by Tri Vo on 7/8/13.
//
//

#include "AboutScreen.h"

using namespace cocos2d;


CCScene *AboutScreen::scene() {
    CCScene *scene = CCScene::create();
    
    AboutScreen *layer = AboutScreen::create();
    
    scene->addChild(layer);
    return scene;
}

bool AboutScreen::init() {
    if (!CCLayer::init()) {
        return false;
    }
    
    CCSize winSize = GameController::getWinSize();
    
    int fontSizeMenu = GameController::getFontSizeForMenu();
    int fontSizeTitle = GameController::getFontSizeForTitle();
    char* fontNameTitle = GameController::getFontNameForTitle();
    char* fontNameMenu = GameController::getFontNameForMenu();
    
    CCLabelTTF *lblTitle = CCLabelTTF::create("About", fontNameTitle, fontSizeTitle);

    lblTitle->setPosition(ccp(winSize.width/2, winSize.height/2 + 120));
    this->addChild(lblTitle);
    
    CCMenuItemFont *btnBack = CCMenuItemFont::create("Back", this, menu_selector(AboutScreen::goBackToMenuScreen));
    btnBack->setFontSize(fontSizeMenu);
    btnBack->setFontName(fontNameMenu);
    
    CCMenu *menu = CCMenu::create(btnBack, NULL);
    menu->alignItemsHorizontally();
    menu->setPosition(ccp(40, winSize.height/2 - 120));
    this->addChild(menu, 1);
    
    return true;
}

#pragma mark - Screen Methods

void AboutScreen::goBackToMenuScreen(CCObject *sender) {
    GameController::popScene(MenuScreen::scene());
}
